#include "Colision.h"


Colision::Colision(void)
{

}


void Colision::updatePlayer(sf::RectangleShape* mPlayer)
{
	player0 = sf::Vector2f(mPlayer->getPosition().x - mPlayer->getOrigin().x,
		mPlayer->getPosition().y - mPlayer->getOrigin().y);

	player1 = sf::Vector2f(mPlayer->getPosition().x + mPlayer->getSize().x - mPlayer->getOrigin().x,
		mPlayer->getPosition().y - mPlayer->getOrigin().y);

	player2 = sf::Vector2f(mPlayer->getPosition().x + mPlayer->getSize().x - mPlayer->getOrigin().x,
		mPlayer->getPosition().y + mPlayer->getSize().y - mPlayer->getOrigin().y);

	player3 = sf::Vector2f(mPlayer->getPosition().x - mPlayer->getOrigin().x,
		mPlayer->getPosition().y + mPlayer->getSize().y - mPlayer->getOrigin().y);
}

void Colision::updatePlansza(sf::RectangleShape* mPlansza)
{
	plansza0 = sf::Vector2f(mPlansza->getPosition());
	plansza1 = sf::Vector2f(mPlansza->getPosition().x + mPlansza->getSize().x,
		mPlansza->getPosition().y);
	plansza2 = sf::Vector2f(mPlansza->getPosition().x + mPlansza->getSize().x,
		mPlansza->getPosition().y + mPlansza->getSize().y);
	plansza3 = sf::Vector2f(mPlansza->getPosition().x,
		mPlansza->getPosition().y + mPlansza->getSize().y);
}

void Colision::updateColisions()
{
	ColsioionRight=
	ColisionLeft=
	ColisionUp=
	ColisionDown=false;

	planszaKolizja();
}

void Colision::planszaKolizja()
{
	if(player0.x <= plansza0.x)
			ColisionLeft=true;

	if(player0.y <= plansza0.y)
			ColisionUp=true;

	if(player1.x >= plansza1.x)
			ColsioionRight=true;

	if(player2.y >= plansza2.y)
			ColisionDown=true;
}